//
//  SKWishListView.m
//  loveKangaroo
//
//  Created by SeeKool on 15/3/4.
//  Copyright (c) 2015年 SeeKool Inc. All rights reserved.
//

#import "SKWishListView.h"
#import "SKWishListCell.h"

@interface SKWishListView ()<UITableViewDataSource,UITableViewDelegate>

@end
@implementation SKWishListView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        CGFloat startX = 10;
        CGFloat margin = 20;
        CGFloat btnWidth = (ScreenWidth - startX * 2 - margin) * 0.5;
        
        UIButton *creatNewWish = [UIButton buttonWithType:UIButtonTypeCustom];
        [creatNewWish setTitle:@"增加一个新的心愿" forState:UIControlStateNormal];
        [creatNewWish setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [creatNewWish setBackgroundColor:[UIColor redColor]];
        creatNewWish.frame = CGRectMake(startX, 0, btnWidth, 30);
        [self addSubview:creatNewWish];
        
        UIButton *lookWish = [UIButton buttonWithType:UIButtonTypeCustom];
        [lookWish setTitle:@"查看心愿单认领状态" forState:UIControlStateNormal];
        [lookWish setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [lookWish setBackgroundColor:[UIColor redColor]];
        lookWish.frame = CGRectMake(CGRectGetMaxX(creatNewWish.frame) + margin, 0, btnWidth, 30);
        [self addSubview:lookWish];
        
        self.backgroundColor = [UIColor greenColor];
        UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 30, ScreenWidth, 300) style:UITableViewStyleGrouped];
        tableView.dataSource = self;
        tableView.delegate = self;
        [self addSubview:tableView];
        
        tableView.sectionHeaderHeight = 0;
        tableView.sectionFooterHeight = 0;
    }
    return self;
}
#pragma mark - UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (0 == section) {
        return 1;
    }else if (1 == section){
        return 2;
    }else if (2 == section){
        return 3;
    }
    return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *ID = @"SKWishListViewCellIdentifier";
    SKWishListCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[SKWishListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    cell.backgroundColor = [UIColor redColor];
    return cell;
}
#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 120;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 10;
}
@end
